A compression algorithm called LZ77 is known. LZ77 is adopted in compression file formats such as ZIP.
In LZ77, a compression process for data in a file is executed sequentially from the beginning of a compression target file. In LZ77, a data reference region (referred to as a slide window or the like) is set and data subjected to the compression process in the compression target file is stored sequentially in the slide window. The size of the slide window is set in advance. When the size of the data stored in the slide window exceeds the size of the slide window, the data is stored while the data stored beforehand in the slide window is updated.
In the compression process executed sequentially in LZ77, compressed codes are used which are generated based on a data string (longest matching data string) which matches longest piece of data to be executed in the compression process in the compression target file in the data included in the slide window. The compressed codes are information in which a matching length of the longest matching data string of the slide window and a position in the slide window are combined.
According to LZ77, as the matching length of the longest matching data string is longer, considerable data is expressed by one compressed code (a combination of the matching length and the position), thereby improving a compression ratio. When the longest matching data string of the matching length is considerably extracted from the compression target file, the compression ratio is improved. Therefore, there is a tendency to improve the compression ratio when the size of the slide window increases. This is because a probability of specifying the data string of which the matching length is long is improved since data matching processing target data is found from more data in the compression target file.
In a decompression process, decompression is performed with reference to a slide window for each compressed code that is sequentially read from the head of a compressed file, and data in the slide window is updated based on the decompressed data. Based on the data in the slide window, which is thus sequentially updated, the compressed code is decompressed.
As an example in the related art, Japanese Laid-open Patent Publication No. 5-241777 is known.